package com.woniu.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.woniu.dto.Result;
import com.woniu.dto.StatusCode;
import com.woniu.service.FeedbackService;
import com.woniu.vo.PositionVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zyy
 * @author xiayang
 * @since 2021-03-09
 */
@RestController
@RequestMapping("/feedback")
public class FeedbackController {
    @Resource
    private FeedbackService feedbackService;

    //招聘者查看简历表分页
    @GetMapping("/getPage")
    public Result getPage(PositionVo positionVo, Integer uid){
        return new Result(true, StatusCode.OK,
                "分页查询",feedbackService.getPage(positionVo,uid,"待处理"));
    }

    @GetMapping("/getFPage")
    public Result getFPage(PositionVo positionVo, Integer uid){
        return new Result(true, StatusCode.OK,
                "分页查询",feedbackService.getPage(positionVo,uid,"已拒绝"));
    }

    @GetMapping("/getIPage")
    public Result getIPage(PositionVo positionVo, Integer uid){
        return new Result(true, StatusCode.OK,
                "分页查询",feedbackService.getPage(positionVo,uid,"已邀请"));
    }

    @GetMapping("/getAPage")
    public Result getAPage(PositionVo positionVo, Integer uid){
        return new Result(true, StatusCode.OK,
                "分页查询",feedbackService.getPg(positionVo,uid));
    }

    //删除
    @GetMapping("deleteP")
    public Result deleteP(@RequestParam List<String> Ids){
        feedbackService.deleteP(Ids);
        return new Result(true, StatusCode.OK,"删除成功");
    }

    //修改
    @GetMapping("/updateI/{id}")
    public Result updateP(@PathVariable String id){
        feedbackService.updateR(id,"已邀请");
        return new Result(true, StatusCode.OK,"邀请成功");
    }

    @GetMapping("/updateR/{id}")
    public Result updateR(@PathVariable String id){
        feedbackService.updateR(id,"已拒绝");
        return new Result(true, StatusCode.OK,"拒绝");
    }
}

